From c0477c2c5242f678155316714c0394039ed8fd7b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 7 Dec 2015 16:32:15 +0100 Subject: [PATCH] GtkNotebook: Use gdouble in coordinate calculations Otherwise rounding errors fool the "tab under coordinates" checks on crossing events, which will be triggered close enough to the window rectangle if the pointer moves slowly enough. With this, the tab_prelight() function correctly figures out we've moved the pointer outside the tab area when called in gtk_notebook_leave_notify(). https://bugzilla.gnome.org/show_bug.cgi?id=759091 --- gtk/gtknotebook.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 6871074fea..91af61ba37 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2873,8 +2873,8 @@ gtk_notebook_arrow_button_press (GtkNotebook *notebook, static gboolean get_widget_coordinates (GtkWidget *widget, GdkEvent *event, - gint *x, - gint *y) + gdouble *x, + gdouble *y) { GdkWindow *window = ((GdkEventAny *)event)->window; gdouble tx, ty; @@ -2905,7 +2905,9 @@ get_widget_coordinates (GtkWidget *widget, } static GList* -get_tab_at_pos (GtkNotebook *notebook, gint x, gint y) +get_tab_at_pos (GtkNotebook *notebook, + gdouble x, + gdouble y) { GtkNotebookPrivate *priv = notebook->priv; GtkNotebookPage *page; @@ -2939,7 +2941,7 @@ gtk_notebook_button_press (GtkWidget *widget, GtkNotebookPage *page; GList *tab; GtkNotebookArrow arrow; - gint x, y; + gdouble x, y; if (event->type != GDK_BUTTON_PRESS || !priv->children || priv->button) @@ -3323,7 +3325,7 @@ tab_prelight (GtkNotebook *notebook, { GtkNotebookPrivate *priv = notebook->priv; GList *tab; - gint x, y; + gdouble x, y; if (get_widget_coordinates (GTK_WIDGET (notebook), (GdkEvent *)event, &x, &y)) { @@ -3354,7 +3356,7 @@ gtk_notebook_leave_notify (GtkWidget *widget, { GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkNotebookPrivate *priv = notebook->priv; - gint x, y; + gdouble x, y; if (get_widget_coordinates (widget, (GdkEvent *)event, &x, &y)) { -- 2.30.2